<!DOCTYPE html>
<html>
<head>
	<script type="text/javascript" src="__PUBLIC__/easyui/jquery.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/easyui/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/easyui/locale/easyui-lang-zh_CN.js"></script>
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/easyui/themes/gray/easyui.css">
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/easyui/themes/icon.css">
	<script type="text/javascript" src="__PUBLIC__/js/add-tab.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/datagrid-detailview.js"></script>
	<script type="text/javascript">
	$(function(){
		$('#tt').datagrid({
			view: detailview,
			detailFormatter:function(index,row){
				return '<div style="padding:2px"><table id="ddv-' + index + '"></table></div>';
			},
			onExpandRow: function(index,row){
				$('#ddv-'+index).datagrid({
					url:'__URL__/buyGoodsDetail?goods_id='+row.goods_id,
					fitColumns:true,
					singleSelect:true,
					rownumbers:true,
					loadMsg:'',
					height:'auto',
					columns:[[
						{field:'buygoods_name',title:'名称',width:100,align:'center'},
						{field:'buygoods_count',title:'数量',width:100,align:'center'},
						{field:'buygoods_price',title:'价格（元）',width:100,align:'center'},
						{field:'buygoods_use',title:'用途',width:100,align:'center'},
					]],
					onResize:function(){
						$('#tt').datagrid('fixDetailRowHeight',index);
					},
					onLoadSuccess:function(){
						setTimeout(function(){
							$('#tt').datagrid('fixDetailRowHeight',index);
						},0);
					}
				});
				$('#tt').datagrid('fixDetailRowHeight',index);
			}
		});
	})
	function formatTime(val,row) {     
	 	return new Date(parseInt(val) * 1000).toLocaleString().replace(/年|月/g, "-").replace(/日/g, " ");
	} 
	</script>
</head>
<body>
	<table id="tt" class="easyui-datagrid" title="购买物品记录" style="width:auto;height:auto"
			data-options="rownumbers:true,singleSelect:true,url:'__URL__/buyGoodsData',toolbar:'#tb'" rownumbers="true" pagination="true" fitColumns="true" fit="true" pageSize="20" pageList="[20,40,80]">
		<thead>
			<tr>
				<th field="goods_number" width="80" align="center">编号</th>
				<th field="goods_type" width="80" align="center">类型</th>
				<th field="process_begin_id" width="80" align="center">申请人</th>
				<th field="goods_des" width="80" align="center">备注</th>
				<th field="process_time" formatter="formatTime" width="80" align="center">申请时间</th>
			</tr>
		</thead>
	</table>
</body>
</html>